package com.wemake.linphonetmp;

import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;

import org.linphone.core.LinphoneAddress;
import org.linphone.core.LinphoneCall;
import org.linphone.core.LinphoneCore;
import org.linphone.core.LinphoneCoreException;
import org.linphone.core.LinphoneCoreFactory;
import org.linphone.core.LinphoneCoreListener;
import org.linphone.core.LinphoneCoreListenerBase;
import org.linphone.core.LinphoneProxyConfig;
import org.linphone.mini.LinphoneMiniManager;

public class MainActivity extends AppCompatActivity {


   private LinphoneMiniManager manager;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        init();
    }

    private void init() {
       manager = new LinphoneMiniManager(this);

       String sipAddress = "sip:6004@192.168.9.99:5060";
       String password = "Zc123456";
       String port = "5060";

        try {
            LinphoneMiniManager.getInstance().linPhoneRegister(sipAddress,password,port);
        } catch (LinphoneCoreException e) {
            e.printStackTrace();
        }

        LinphoneMiniManager.getInstance().linPhoneOutCall("917682309830");

        Handler handler = new Handler();

        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                LinphoneMiniManager.getInstance().hangUp();
            }
        }, 30000);
    }


}
